import AppResponse from "response";
import {Request} from "hapi";
import fs from 'fs'
import Busboy from 'busboy'
import time_uuid from 'time-uuid'
import {systemConfig} from '../config'
import {Success} from "@/utils/responseUtil";

export default class VideoService {
    static async handleUploadFile(request: Request) {
        let busboy = new Busboy({headers: request.headers})
        let chunkId: string = time_uuid()
        let infile, done = false
        busboy.on('file',function( fieldname, file, filename, encoding) {
            let fsname = time_uuid()
            if(done) {

            }
        })
        busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype){

        })
        busboy.on('finish', function () {
            done = true
        })
        request.raw.req.pipe(busboy)
        return Success("success")
    }
}
